import 'dart:async';

import 'package:flutter/services.dart';

class WifiIpInfo {
  final String? ip;
  final String? netmask;
  final String? broadcastIP;

  WifiIpInfo.fromMap(Map<String, String> map)
      : ip = map["ip"],
        netmask = map["netmask"],
        broadcastIP = map["broadcastIP"];
}

class WifiIp {
  static const MethodChannel _channel = const MethodChannel('wifi_ip_info');

  static Future<WifiIpInfo> get getWifiIp async {
    Map? result = await _channel.invokeMethod('getWifiIp');
    final Map wifiInfoMap = Map<String, String>.from(result ?? {});
    return WifiIpInfo.fromMap(wifiInfoMap as Map<String, String>);
  }
}
